/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package SRD.util;

import java.io.*;
import java.net.*;

/**
 *
 * @author ylopez
 */
public class client {
    public static void main(String[] args) throws IOException {

        Socket kkSocket = null;
        PrintWriter out = null;
        BufferedReader in = null;
        InetAddress inetAddDrep = null;

        try {
            inetAddDrep = InetAddress.getByName("localhost");
            kkSocket = new Socket(inetAddDrep, 43718);
            out = new PrintWriter(kkSocket.getOutputStream(), true);
            in = new BufferedReader(new InputStreamReader(kkSocket.getInputStream()));
        } catch (UnknownHostException e) {
            System.err.println("Don't know about host: taranis.");
            System.exit(1);
        } catch (IOException e) {
            System.err.println("Couldn't get I/O for the connection to: taranis.");
            System.exit(1);
        }

        BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
        String fromServer;
        String fromUser;

        while (!(fromUser = stdIn.readLine()).equals("Bye")) {
            out.println(fromUser);
        }

        out.close();
        in.close();
        stdIn.close();
        kkSocket.close();
    }
}
